<template>
    <div class="box">
        <h3>{{ msg }}</h3>
        <h3>儿子小明: 有存款: {{ money }}</h3>
        <button @click="giveMoney(50)">给BABA钱: 50</button>
    </div>
</template>

<script>
import mixin from './mixin'
export default {
    name: 'Son',
    mixins: [mixin],
    data() {
        return {
            money: 30000
        }
    },
    mounted() {
        console.log('组件的 mounted - son')
    },
    methods: {
        giveMoney(money) {
            this.money -= money;
            
            this.$parent.money += money;
        }
    }
}
</script>
